<template>
	<view class="collect-list-item" @click="toCollectInfo(data)">
		<view class="list-item-top">
			<view class="list-item-title">{{data.title}}</view>
			<text class="list-item-tag">{{data.tag}}</text>
		</view>
		<view class="list-item-bottom">
			收藏时间：{{data.coltime}}
		</view>
	</view>
</template>

<script>
	export default {
		name: "collectitem",
		props: {
			data: {
				type: Object,
				default: {
					id: 0,
					title: "默认标题",
					tag: "面试题",
					answer: `默认答案`,
					coltime: "默认收藏时间",
					updtime: "默认上传时间",
					coltype: 1,
				}
			}
		},
		data() {
			return {

			};
		},
		methods: {
			toCollectInfo(data) {
				// 解决
				uni.navigateTo({
					url: `/pages/collectinfo/collectinfo?data= ${encodeURIComponent(JSON.stringify(data))}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.collect-list-item {
		border-bottom: 1px solid #c1c1c1;
		padding: 20rpx;

		.list-item-top {
			@include flex;

			.list-item-title {
				flex: 1;
				font-size: 38rpx;
				line-height: 60rpx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}

			.list-item-tag {
				width: 140rpx;
				height: 60rpx;
				color: #fff;
				text-align: center;
				line-height: 60rpx;
				background-color: #007aff;
				margin-left: 4rpx;
				border-radius: $uni-border-radius-base;
			}
		}

		.list-item-bottom {
			// text-align: right;
			margin-top: 20rpx;
			font-size: 30rpx;
			color: #767676;
		}
	}
</style>
